package com.baorant.springdemo1.mapper;

import com.baorant.springdemo1.domain.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("SELECT name,password,CONCAT('ROLE_', role) as authority  FROM users WHERE name = #{name}")
    User findByName(@Param("name") String name);

    @Insert("INSERT INTO users(name, password) VALUES(#{name}, #{password})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(User user);
}